/*     */ package com.lmpop.trade.ti_lawyerask;
/*     */ 
/*     */ import com.lmpop.frame.QueryList;
/*     */ import com.lmpop.frame.SysMap;
/*     */ import com.lmpop.frame.TradeInterf;
/*     */ import com.lmpop.frame.dao.DbmInterf;
/*     */ import com.lmpop.frame.exp.ApplicationException;
/*     */ import com.lmpop.frame.util.RandomID;
/*     */ import java.util.Hashtable;
/*     */ import java.util.List;
/*     */ 
/*     */ public class Ti_LawyeraskInfo
/*     */   implements TradeInterf
/*     */ {
/*     */   QueryList queryList;
/*     */ 
/*     */   public Ti_LawyeraskInfo()
/*     */   {
/*  16 */     this.queryList = new QueryList();
/*     */   }
/*     */ 
/*     */   public SysMap insert(DbmInterf dbmMgr, SysMap map) {
/*  20 */     String result_info = "";
/*  21 */     Ti_lawyerask lawyerask = new Ti_lawyerask();
/*  22 */     String result_code = "0";
/*  23 */     RandomID random = new RandomID();
/*  24 */     lawyerask.setAsk_id(random.GenTradeId());
/*  25 */     lawyerask.setTitle(map.getString("title"));
/*  26 */     lawyerask.setContent(map.getString("content"));
/*  27 */     lawyerask.setEmail(map.getString("email"));
/*  28 */     lawyerask.setArea_attr(map.getString("area_attr"));
/*  29 */     lawyerask.setTel(map.getString("tel"));
/*  30 */     lawyerask.setQq(map.getString("qq"));
/*     */     try {
/*  32 */       insert(dbmMgr, lawyerask);
/*  33 */       result_info = "1";
/*     */     } catch (ApplicationException e) {
/*  35 */       e.printStackTrace();
/*  36 */       result_code = "1";
/*     */     }
/*  38 */     map.setString("result_code", result_code);
/*  39 */     map.setString("result_info", result_info);
/*  40 */     return map;
/*     */   }
/*     */ 
/*     */   public void insert(DbmInterf dbmMgr, Ti_lawyerask ti_admin) throws ApplicationException
/*     */   {
/*  45 */     dbmMgr.update("insertTi_lawyerask", ti_admin);
/*     */   }
/*     */ 
/*     */   public SysMap delete(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  50 */     String pkid_string = map.getString("ask_id");
/*  51 */     String result_code = "0";
/*     */     try {
/*  53 */       if (!pkid_string.equals("")) {
/*  54 */         String[] pkStr = pkid_string.split("\\|");
/*  55 */         for (int i = 0; i < pkStr.length; i++) {
/*  56 */           if (pkStr[i].equals("")) continue; delete(dbmMgr, pkStr[i]);
/*     */         }
/*     */       }
/*     */     } catch (ApplicationException e) {
/*  60 */       e.printStackTrace();
/*  61 */       result_code = "1";
/*     */     }
/*  63 */     map.setString("result_code", result_code);
/*  64 */     return map;
/*     */   }
/*     */ 
/*     */   public void delete(DbmInterf dbmMgr, String pkid) throws ApplicationException {
/*  68 */     dbmMgr.update("deleteTi_lawyerask", pkid);
/*     */   }
/*     */ 
/*     */   public SysMap update(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  73 */     Ti_lawyerask lawyerask = new Ti_lawyerask();
/*  74 */     lawyerask.setAsk_id(map.getString("ask_id"));
/*  75 */     lawyerask.setTitle(map.getString("title"));
/*  76 */     lawyerask.setContent(map.getString("content"));
/*  77 */     lawyerask.setEmail(map.getString("email"));
/*  78 */     lawyerask.setArea_attr(map.getString("area_attr"));
/*  79 */     lawyerask.setTel(map.getString("tel"));
/*  80 */     lawyerask.setQq(map.getString("qq"));
/*  81 */     lawyerask.setEnabled(map.getString("enabled"));
/*  82 */     lawyerask.setOperator_id(map.getString("operator_id"));
/*  83 */     String result_code = "0";
/*     */     try {
/*  85 */       update(dbmMgr, lawyerask);
/*     */     } catch (ApplicationException e) {
/*  87 */       e.printStackTrace();
/*  88 */       result_code = "1";
/*     */     }
/*  90 */     map.setString("result_code", result_code);
/*  91 */     return map;
/*     */   }
/*     */ 
/*     */   public void update(DbmInterf dbmMgr, Ti_lawyerask ti_admin) throws ApplicationException
/*     */   {
/*  96 */     dbmMgr.update("updateTi_lawyerask", ti_admin);
/*     */   }
/*     */ 
/*     */   public List getListByPage(Object obj, int start, int limit)
/*     */   {
/* 103 */     Ti_lawyerask ti_lawyer = (Ti_lawyerask)obj;
/* 104 */     if (start == 0)
/* 105 */       start = 0;
/*     */     else {
/* 107 */       start = (start - 1) * limit;
/*     */     }
/*     */ 
/* 110 */     ti_lawyer.setStart(Integer.valueOf(start));
/* 111 */     ti_lawyer.setLimit(Integer.valueOf(limit));
/*     */ 
/* 113 */     return this.queryList.getList("getTi_lawyeraskList", ti_lawyer);
/*     */   }
/*     */ 
/*     */   public int getCountByObj(Object obj)
/*     */   {
/* 118 */     Ti_lawyerask ti_lawyer = (Ti_lawyerask)obj;
/* 119 */     List list = this.queryList.getList("getTi_lawyeraskCount", ti_lawyer);
/* 120 */     int count = 0;
/* 121 */     if ((list != null) && (list.size() > 0)) {
/* 122 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 123 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 124 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 127 */     return count;
/*     */   }
/*     */ 
/*     */   public List getListByPk(String pk) {
/* 131 */     return this.queryList.getList("getTi_lawyeraskByPk", pk);
/*     */   }
/*     */ 
/*     */   public Boolean checkUserEmail(String email) {
/* 135 */     List list = this.queryList.getList("Ti_lawyerask_checkUserEmail", email);
/* 136 */     if ((list != null) && (list.size() > 0)) {
/* 137 */       return Boolean.valueOf(true);
/*     */     }
/* 139 */     return Boolean.valueOf(false);
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.trade.ti_lawyerask.Ti_LawyeraskInfo
 * JD-Core Version:    0.6.0
 */